<template>
  <div class="head-container">
    <!-- 搜索 -->
    <el-input v-model="paramBean.cpyName" clearable placeholder="输入名称搜索" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery"/>
    <el-select v-model="paramBean.cpyStatus" clearable placeholder="状态" class="filter-item" style="width: 90px" @change="toQuery">
      <el-option v-for="item in cpyStatusList" :key="item.id" :label="item.dictName" :value="item.dictCode"/>
    </el-select>
    <el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
    <!-- 新增 -->
    <div v-permission="['SYS_ADMIN']" style="display: inline-block;margin: 0px 2px;">
      <el-button
        class="filter-item"
        size="mini"
        type="primary"
        icon="el-icon-plus"
        @click="add">新增</el-button>
      <eForm ref="form" :is-add="true" :sup_this="sup_this" :dicts="dicts"/>
    </div>
  </div>
</template>

<script>
import eForm from './form'
import initDict from '@/mixins/initDict'

export default {
  components: { eForm },
  mixins: [initDict],
  props: {
    paramBean: {
      type: Object,
      required: true
    },
    dicts: {
      type: Object,
      required: true
    },
    sup_this: {
      type: Object,
      required: true
    },
    cpyStatusList: {
      type: Array,
      required: true
    }
  },
  methods: {
    beforeCreate() {
      // this.getDictByType('cpy_status')
    },
    toQuery() {
      this.$parent.page = 0
      this.$parent.init()
    },
    add() {
      const _this = this.$refs.form
      _this.dialog = true
    }
  }
}
</script>
